<?php

use App\Http\Middleware\Supplier;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\supplier\SupplierLogonController;
use App\Http\Controllers\supplier\SupplierGoodsController;
use App\Http\Controllers\supplier\SupplierOrderController;
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/


Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
    return $request->user();
});
//供应商登录
Route::prefix('logon')->group(function () {
    Route::controller(SupplierLogonController::class)->group(function () {
        Route::post('register', 'register')->withoutMiddleware(Supplier::class);//供应商注册
        Route::post('is_phones', 'is_phones')->withoutMiddleware(Supplier::class);//验证手机号
        Route::post('sendSms_login', 'sendSms_login')->withoutMiddleware(Supplier::class);//登录发送验证码
        Route::post('no_password', 'no_password')->withoutMiddleware(Supplier::class);//忘记密码
        Route::post('authentication','authentication')->middleware("auth:support")->withoutMiddleware(Supplier::class);//供应商认证身份
        Route::post('qiniuToken', "qiniuToken")->middleware("auth:support")->withoutMiddleware(Supplier::class); // 图片上传
        Route::post('authentication_info', "authentication_info")->middleware("auth:support")->withoutMiddleware(Supplier::class); // 认证详情
        Route::post('aaaaa', "aaaaa")->middleware("auth:support"); // 测试
    });
    Route::controller(App\Http\Controllers\supplier\AuthController::class)->withoutMiddleware(Supplier::class)->group(function () {
       Route::any('login', "login");     // 登录
       Route::any('logout', "logout");   // 退出
       Route::any('refresh', "refresh"); // 刷新
    });
    Route::controller(SupplierLogonController::class)->group(function(){
        Route::any('mysql_test','mysql_test');//测试
    });
});

//供应商商品
Route::prefix('goods')->group(function () {
    Route::controller(SupplierGoodsController::class)->middleware('auth:support')->group(function () {
        Route::post('warehouse', 'warehouse');//供应商商品仓库
        Route::post('edit', 'edit');//供应商商品编辑
        Route::post('add', 'add');//供应商商品添加
        Route::post('authority', 'authority');//供应商商品权限列表
        Route::post('list', 'list');//供应商商品列表
        Route::post('is_up', 'is_up');//供应商商品上下架
        Route::post('del', 'del');//供应商商品列表删除
        Route::post('release', 'release');//供应商商品状态修改
        Route::post('regular_release', 'regular_release');//供应商商品定时上下架
        Route::post('regular_release_list', 'regular_release_list');//供应商商品定时上下架列表
        Route::post('regular_price', 'regular_price');//供应商商品定时改价
        Route::post('regular_price_revoke', 'regular_price_revoke');//供应商商品撤销定时改价
        Route::post('association', 'association');//供应商关联子商品列表
        Route::post('association_edit', 'association_edit');//供应商关联子商品操作
        Route::post('child_goods_topping', 'child_goods_topping');//供应商关联子商品置顶操作
        Route::post('child_goods_percentage', 'child_goods_percentage');//供应商关联子商品设置百分百
        Route::post('merchant_invoicing_list', 'merchant_invoicing_list');//商户开票商户列表
        Route::post('invoicing_list', 'invoicing_list');//商户开票商户商品列表
        Route::post('invoicing_edit', 'invoicing_edit');//供应商设置开票商品价格
        Route::post('invoicing_association', 'invoicing_association');//开票商品关联子商品列表
        Route::post('invoicing_association_edit', 'invoicing_association_edit');//开票商品关联子商品操作
        Route::post('invoicing_regular_price', 'invoicing_regular_price');//供应商设置开票商品定时改价
        Route::post('invoicing_regular_price_revoke', 'invoicing_regular_price_revoke');//供应商撤销开票商品定时改价
        Route::post('invoicing_regular_release', 'invoicing_regular_release');//供应商设置开票商品定时上下架
        Route::post('invoicing_regular_release_list', 'invoicing_regular_release_list');//供应商设置开票商品定时上下架列表
        Route::post('invoicing_child_goods_topping', 'invoicing_child_goods_topping');//开票子商品置顶
        Route::post('invoicing_child_goods_percentage', 'invoicing_child_goods_percentage');//开票子商品设置百分比
        Route::post('allrechargelist', 'allrechargelist');//全充值商品关联列表-不带票
        Route::post('invoicing_allrechargelist', 'invoicing_allrechargelist');//全充值商品关联列表-带票
        Route::post('allrecharge_association', 'allrecharge_association');//全充值商品关联操作

    });
});
//供应商订单
Route::prefix('order')->group(function () {
    Route::controller(SupplierOrderController::class)->middleware("auth:support")->group(function () {
        Route::post('order_list', 'order_list');//供应商订单列表
        Route::post('invoicing_order_list', 'invoicing_order_list');//供应商开票订单列表
        Route::post('bill_list', 'bill_list');//供应商账单列表
        Route::post('invoicing_bill_list', 'invoicing_bill_list');//供应商开票账单列表
        Route::post('order_edit', 'order_edit')->withoutMiddleware("auth:support");//订单发货
        Route::post('eachOrder', 'eachOrder');//循环冲数据列表
        Route::post('fullorder', 'fullorder');//组合数据列表
    });
});






